/**
 * @file Define controllers for all settings handlersPath
 * 
 * @author Steve Gao<gaofu@parllay.com>
 */
const WebBaseController = require('./web-base-controller');
const {SystemServices}  = require('../../constants');

class SettingsController extends WebBaseController {
    
    get wallService() {
        if (!this._wallService) {
            this._wallService = this.getSystemService(SystemServices.WALL_SERVICE);
        }
        return this._wallService;
    }

    get name() {
        return 'SettingsController';
    }

    get handlersPath() {
        return 'settings';
    }

    getUserProfile(userId, parentCallback) {
        this.wallService.getUserProfile(userId, (result) => {
            parentCallback(result);
        });
    }

    updateUserProfile(userInfo, parentCallback) {
        this.wallService.updateUserProfile(userInfo, (result) => {
            parentCallback(result);
        });
    }

    /**
     * Get image URL with CDN host
     * 
     * @name getCDNImageURL
     * @param {String} image - The original image URL
     * 
     * @returns {String}
     */
    getCDNImageURL(image) {
        return this.wallService.getCDNImageURL(image);
    }
}

exports.SettingsController = SettingsController;